package cn.edu.scau.chentingyu.client;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public class Client {
	
		public void main(String[] args) throws ClassNotFoundException,SQLException{
			Class.forName("com.mysql.jdbc.Driver");
			String url="jdbc:mysql://localhost:3306/jsp";
			String username="root";
			String password="root";
			Connection conn=DriverManager.getConnection(url, username,password);
			String insertSqlStatic="insert into tb_student(age,sex,name,id)values('22','1','zhangshan','123')";
			Statement ps =conn.prepareStatement(insertSqlStatic);
			
			//String insertSqlDynamic="insert into tb_student(age,sex,name,id)values(?,?,?,?)";
			//PreparedStatement dps =conn.prepareStatement(insertSqlDynamic);
			//dps.setInt(1, 25);
			//dps.setInt(2, 1);
			//dps.setString(3, "zhangxiaohua");
			//dps.setInt(4, 234);
			
			ps.executeUpdate(insertSqlStatic);
			//dps.executeUpdate();
			System.out.print("OK");
		}
	}

